﻿using System;
using System.Configuration;
using Grundy.Client;
using log4net;

namespace Grundy.Licensing.Server.Web
{
    public class Application
    {
        ILog _logger = log4net.LogManager.GetLogger(typeof(Application));

        private static Application _instance = new Application();
        
        protected Application()
        {
            ClientConfiguration = ClientConfiguration.Instance;
        }

        public LicenseClient GetLicenseClient()
        {
            string customerKey = ConfigurationManager.AppSettings["LicenseServerWebsiteUserKey"];
            var licenseClient = new LicenseClient(ClientConfiguration, customerKey, customerName: "LicenseServerWebsiteUser");
            return licenseClient;
        }

        public ClientConfiguration ClientConfiguration { get; private set; }

        public static Application Instance { get { return _instance; } }
    }
}